import { defHttp } from '/@/utils/http/axios';
import {  WebsiteAboutUsModel, WebsiteAboutUsTableRecordModel } from '../model/websiteAboutUsModel';
import { ErrorMessageMode } from "/#/axios";

enum Api {
  WEBSITEABOUTUS_PAGE = '/jxxhWebsite/websiteAboutUs/getAboutUsVosPage',
  GET_WEBSITEABOUTUSVO_BY_ID = '/jxxhWebsite/websiteAboutUs/',
  WEBSITEABOUTUSVO_SAVE = '/jxxhWebsite/websiteAboutUs/save',
  WEBSITEABOUTUSVO_UPDATE = '/jxxhWebsite/websiteAboutUs/updateById',
  WEBSITEABOUTUSVO_REMOVE = '/jxxhWebsite/websiteAboutUs/logicalRemoveById/',
}

/**
 * @description: Get sample list value
 */

export const websiteAboutUsListApi = (params: Object) =>
  defHttp.get<WebsiteAboutUsTableRecordModel>(
    {url: Api.WEBSITEABOUTUS_PAGE,params },
    { errorMessageMode: 'message' }
  );

export const getWebsiteAboutUsVoByIdApi = (id) =>
  defHttp.get<WebsiteAboutUsModel>(
    {url: Api.GET_WEBSITEABOUTUSVO_BY_ID+id },
    { errorMessageMode: 'message' }
  );

export function websiteAboutUsSaveApi(params: WebsiteAboutUsModel, mode: ErrorMessageMode = 'modal') {
  return defHttp.post<WebsiteAboutUsModel>(
    {
      url: Api.WEBSITEABOUTUSVO_SAVE,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export function websiteAboutUsUpdateApi(params: WebsiteAboutUsModel, mode: ErrorMessageMode = 'modal') {
  return defHttp.put<WebsiteAboutUsModel>(
    {
      url: Api.WEBSITEABOUTUSVO_UPDATE,
      params,
    },
    {
      errorMessageMode: mode,
    },
  );
}
export const logicalRemoveById = (id) =>
  defHttp.delete<WebsiteAboutUsModel>(
    {url: Api.WEBSITEABOUTUSVO_REMOVE+id },
    { errorMessageMode: 'message' }
  );
